<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<html>
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <title>Hello, world!</title>
    <script src="js/jquery-1.12.4.js"></script>
</head>
<body>
<%@include file="common/AdminNavbar.jsp" %>
<div class="container">
    <div class="card" style="width: 18rem;">
        <img src="images/${classifyName}/${book.bookName}.jpg" class="card-img-top" alt="...">
        <div class="card-body">
            <h5 class="card-title" id="name">${book.bookName}</h5>
            <p class="card-text">${book.bookAuthor}</p>
        </div>
        <ul class="list-group list-group-flush">
            <li class="list-group-item">出版社：${book.pubs}</li>
            <li class="list-group-item" id="price">价格：￥${book.price}</li>
            <li class="list-group-item">剩余数量：${book.bookCount}</li>

        </ul>
        <input type="hidden" value="${book.bookId}" name="bookId" id="bookId"/>
        <input type="hidden" value="1" name="count" id="count"/>
        <div class="card-body">
            <a class="btn btn-primary" href="/delBook?bookId=${book.bookId}" role="button" >删除图书</a>
            <a class="btn btn-primary" href="/modifyBookInput?bookId=${book.bookId}" role="button" >修改图书</a>
        </div>
    </div>
</div>
<script>
    function buy() {
        var current = $("#current").html() - 0;
        var price = $("#price").html() - 0;
        var name = $("#name").html();
        alert('确认购买吗？');
        window.location.href = 'buy.jsp?count='+current+'&price='+price+'&name='+name;
    }
    function cart() {
        var current = $("#current").html() - 0;
        var price = $("#price").html() - 0;
        var name = $("#name").html();
        var bookId = $("#bookId").val() - 0;
        alert('确认加入购物车吗？');
        window.location.href = 'addToCart?count='+current+'&bookId='+bookId;
    }

</script>
</body>
</html>